﻿<!-- 工作量-系部确认工作量 -->
<template>
    <div>
        <!-- 添加按钮 -->
        <div class="btn-add">
            <button type="button" class="btn btn-info btn-lg hide" @click="addsk()"><i class="iconfont icon-xinjian ft12 mr5"></i>补增上课记录</button>

            <button type="button" class="btn btn-success btn-lg" @click="skqr()"><i class="iconfont icon-chenggong ft12 mr5"></i>上课确认</button>
            <button type="button" class="btn btn-danger btn-lg" @click="skqx()"><i class="iconfont icon-chexiao ft12 mr5"></i>上课撤销</button>
        </div>
        <!-- 按条件选择 -->



        <div class="tab-filter-type ">

            <div class="col-xs-2 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">学期</button>
                    </div>
                    <base-xq :pzoption="query.xq" isnow></base-xq>

                </div>
            </div>
            <div class="col-xs-2 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">系部</button>
                    </div>
                    <base-xb :pzoption="query.xb" isqx></base-xb>

                </div>
            </div>
            <div class="col-xs-2 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">周次</button>
                    </div>
                    <el-select placeholder="请选择周次" size="mini" v-model="query.zc" class="form-control filter" style="height: 34px;padding:0px">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="第一周" value="1"></el-option>
                        <el-option label="第二周" value="2"></el-option>
                        <el-option label="第三周" value="3"></el-option>
                        <el-option label="第四周" value="4"></el-option>
                        <el-option label="第五周" value="5"></el-option>
                        <el-option label="第六周" value="6"></el-option>
                        <el-option label="第七周" value="7"></el-option>
                        <el-option label="第八周" value="8"></el-option>
                        <el-option label="第九周" value="9"></el-option>
                        <el-option label="第十周" value="10"></el-option>
                        <el-option label="第十一周" value="11"></el-option>
                        <el-option label="第十二周" value="12"></el-option>
                        <el-option label="第十三周" value="13"></el-option>
                        <el-option label="第十四周" value="14"></el-option>
                        <el-option label="第十五周" value="15"></el-option>
                        <el-option label="第十六周" value="16"></el-option>
                        <el-option label="第十七周" value="17"></el-option>
                        <el-option label="第十八周" value="18"></el-option>
                        <el-option label="第十九周" value="19"></el-option>
                        <el-option label="第二十周" value="20"></el-option>
                        <el-option label="第廿一周" value="21"></el-option>
                        <el-option label="第廿二周" value="22"></el-option>
                    </el-select>

                </div>
            </div>

            <div class="col-xs-2 padding20">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">确认状态</button>
                    </div>
                    <el-select placeholder="确认状态" size="mini" v-model="query.qrzt" class="form-control filter" style="height: 34px;padding:0px">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="未确认" value="0"></el-option>
                        <el-option label="已确认" value="1"></el-option>

                    </el-select>

                </div>
            </div>
        </div>

        <div class="default-tab ft14  hover-btn" style="overflow-x: inherit;padding:20PX;padding-top:10px">

            <div>
                <div class="col-xs-7">
                </div>
                <div class="col-xs-5 text-right" style="padding-right: 0px;">
                    <div class="input-group">
                        <div class="input-group-btn">
                            <button type="button" style="height: 34px;min-width:80PX" class="btn btn-default  dropdown-toggle">设置代课老师</button>
                        </div>
                        <base-js :pzoption="js"></base-js>
                        <span class="input-group-btn">
                            <button class="btn btn-info" style="height: 34px;" @click="dkls()" type="button">确定</button>
                        </span>
                    </div>
                </div>

            </div>
            <base-table :pzoption="tableop" @selection-change="handleSelectionChange">
            </base-table>
        </div>
        <!-- 表格 -->



    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue'),
            'base-xq': httpVueLoader('/ViewV5/AppPage/QJJW/component/conxq.vue'),
            'base-xb': httpVueLoader('/ViewV5/AppPage/QJJW/component/conxb.vue?v=1'),
            'base-js': httpVueLoader('/ViewV5/AppPage/QJJW/component/conjs.vue')
        },
        data: function () {
            return {
                query: {
                    zc: "",
                    qrzt: "",
                    xq: { value: "" },
                    xb: { value: "" },
                },
                js: { value: "" },
                alldata: [],
                tableop: {
                    title: "教师上课信息",
                    issel: true,
                    iscz: false,
                    height: 500,
                    isxh: true,
                    dataset: [],
                    multipleSelection: [],
                    collist: [
                        { colid: "kcxbmc", colname: "课程系部名称", isshow: true, istip: true },
                        { colid: "kcmc", colname: "课程名称", isshow: true, istip: true },
                        { colid: "kcdm", colname: "课程代码", isshow: true, istip: true },
                        { colid: "jsmc", colname: "上课教师", isshow: true, istip: true },
                        { colid: "skjh", colname: "授课次数", isshow: true, istip: true },
                        { colid: "hbbj", colname: "上课班级", isshow: true, istip: true },
                        { colid: "skz", colname: "周次", isshow: true, istip: true },
                        { colid: "zc", colname: "星期", isshow: true, istip: true },
                        { colid: "jc1", colname: "节次1", isshow: true, istip: true },
                        { colid: "jc2", colname: "节次2", isshow: true, istip: true },
                        { colid: "kss", colname: "课时", isshow: true, istip: true },
                        { colid: "skrs", colname: "人数", isshow: true, istip: true },
                        { colid: "dkjsmc", colname: "代课教师", isshow: true, istip: true },
                        { colid: "sfsk", colname: "是否上课", isshow: true, istip: true },
                        { colid: "skrq", colname: "上课日期", isshow: true, istip: true }


                    ]
                }
            }
        },
        methods: {
            handleSelectionChange(val) {
                this.tableop.multipleSelection = val;
            },
            querydata: function () {
                var pro = this;
                $.getJSON('/API/VIEWAPI.ashx?Action=GZL_GETGZL', { xq: pro.query.xq.value, xbdm: pro.query.xb.value, skz: pro.query.zc, qrzt: pro.query.qrzt }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.tableop.dataset = resultData.Result;
                    }
                })

            },
            dkls: function () {
                var pro = this;
                var ids = [];
                for (var i = 0; i < this.tableop.multipleSelection.length; i++) {
                    ids.push(this.tableop.multipleSelection[i].idn);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                $.getJSON('/API/VIEWAPI.ashx?Action=GZL_SETDKLS', { P1: pro.js.value, P2: ids.join() }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.querydata();
                    }
                })
            },
            skqr: function () {
                this.clskxx("0")
            },
            skqx: function () {
                this.clskxx("1");
            },
            clskxx: function (cztype) {
                var pro = this;
                var ids = [];
                for (var i = 0; i < this.tableop.multipleSelection.length; i++) {
                    ids.push(this.tableop.multipleSelection[i].idn);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                $.getJSON('/API/VIEWAPI.ashx?Action=GZL_SKCZ', { P1: cztype, idn: ids.join() }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.querydata();
                    }
                })

            },
            InitWigetData: function () {
                this.querydata();
            },
        },
        watch: {
            'query': { //深度监听，可监听到对象、数组的变化
                handler(newV, oldV) {
                    var chi = this;
                    if (newV) {
                        if (newV.xb.value) {
                            chi.querydata();
                        }

                    }
                },
                deep: true
            }
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.InitWigetData();
            })

        }
    };
</script>